package com.kaifamiao.month04.day28.work;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.charset.Charset;

public class Demo {

    public static void main(String[] args) throws IOException {

        File file = new File("E:\\1101\\test\\temp\\work28\\test.txt");
        FileInputStream in = new FileInputStream(file);
        FileOutputStream out = new FileOutputStream("E:\\1101\\test\\temp\\work28\\bufferReader-GBK.txt");
        byte[] bytes = new byte[1024];
        int len;
        while ((len = in.read(bytes)) != -1) {
            String str = new String(bytes, 0, len, Charset.defaultCharset());
            byte[] bs = str.getBytes(Charset.forName("GBK"));
            out.write(bs);
        }
        out.flush();
        out.close();
        in.close();
    }
}
